package lc01;

/**
 * @Author Stringzhua
 * @Date 2024/3/26 17:33
 * description:两数之和
 * 暴力求解
 */
public class Test01 {
    public int[] twoSum(int[] nums, int target) {
        int[] result = new int[2];
        for (int i = 0; i < nums.length; i++) {
            for (int j = i+1; j < nums.length; j++) {
                int sum = nums[i] + nums[j];
                if (sum == target) {
                    result[0] = i;
                    result[1] = j;
                    return result;
                }
            }
        }
        return result;
    }

    public static void main(String[] args) {
        int nums[] = {3,3};
        int target = 6;
        Test01 test01 = new Test01();
        int[] ints = test01.twoSum(nums, target);
        for (int i = 0; i < ints.length; i++) {
            System.out.print(i + " ");
        }
    }
}
